var charactorID = 0;//记录选择角色的变量~

function recover(){
	//恢复初始界面
	if(ifGame == 1){
		ifGame = 0;//如果是从游戏界面返回
		location.reload(true);
	}
	
	document.getElementsByClassName('mall')[0].style.display = 'none';
	document.getElementById('background').style.display = 'block';
	document.getElementsByClassName('scoreManage')[0].style.display = 'none';
	document.getElementsByClassName('GameDescription')[0].style.display = 'none';
	document.getElementsByClassName('success')[0].style.display = 'none';
	document.getElementsByClassName('failure')[0].style.display = 'none';
	
	var mainBtn=document.getElementsByClassName('mainButton');
	for(let i = 0, len = mainBtn.length; i < len; i++) {
	    mainBtn[i].style.display="block";//显示按钮
	}
	
	var gameName=document.getElementById('gameName');
	gameName.style.display='block';//显示游戏名称
	
	var returnBtn=document.getElementById('return');
	returnBtn.style.display='none';//隐藏返回键
	
	var chooseBtn = document.getElementsByClassName('characterChooseBtn');
	for(let i = 0, len = chooseBtn.length; i < len; i++) {
	    chooseBtn[i].style.display="none";//隐藏选择按钮
	}
	
}

function clearBackground(){
	// 清理屏幕并显示返回键
	var mainBtn=document.getElementsByClassName('mainButton');
	for(let i = 0, len = mainBtn.length; i < len; i++) {
	    mainBtn[i].style.display="none";
	}
	var chooseBtn = document.getElementsByClassName('characterChooseBtn');
	for(let i = 0, len = chooseBtn.length; i < len; i++) {
	    chooseBtn[i].style.display="none";//隐藏选择按钮
	}
	
	
	var gameName=document.getElementById('gameName');
	gameName.style.display='none';
	
	var returnBtn=document.getElementById('return');
	returnBtn.style.display='block';
	
	document.getElementsByClassName('mall')[0].style.display = 'none';
	
}

function enterCharacterChoose(){
	//进入选择角色界面
	clearBackground();
	var chooseBtn = document.getElementsByClassName('characterChooseBtn');
	for(let i = 0, len = chooseBtn.length; i < len; i++) {
	    chooseBtn[i].style.display="block";//显示选择按钮
	}
}

function characterChoose1(){
	//清屏并开始游戏
	charactorID = 1;
	clearBackground();
	gameBegin();
}

function characterChoose2(){
	//清屏并开始游戏
	charactorID = 2;
	clearBackground();
	gameBegin();
}

function goToStore(){
	clearBackground();
	document.getElementsByClassName('mall')[0].style.display = 'block';
	document.getElementById('background').style.display = 'none';
}

function goToDescription(){
	clearBackground();
	document.getElementsByClassName('GameDescription')[0].style.display = 'block';
}

function goToSuccess(){
	clearBackground();
	document.getElementsByClassName('success')[0].style.display = 'block';
	}
	
function goToFailure(){
		clearBackground();
		document.getElementsByClassName('failure')[0].style.display = 'block';
	}
	
function pauseOrResume(){
	game.paused = true;
}